package com.gzx.plugin.tjzy.core.utils.crypter;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * 简单的密文对象
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SimpleCiphertext implements Ciphertext {

    private String raw;

    private String enc;

    private String mask;

    public static SimpleCiphertext withRaw(String raw) {
        return new SimpleCiphertext(raw, null, null);
    }

    public static SimpleCiphertext withEnc(String enc) {
        return new SimpleCiphertext(null, enc, null);
    }

    @Override
    public boolean isEmpty() {
        return Objects.isNull(raw) && Objects.isNull(enc);
    }
}
